package OOP.SmallCash;

import java.util.Scanner;
/*
项目需求说明
使用Java开发零钱通项目，可以完成收益入账，消费，查看明细，退出系统等功能
 */
public class Menu {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean iscontinue = true;
        //实例化钱包，初始值为零
        Pocket pocket = new Pocket(0.0);
        Recoder rec = new Recoder();
        while(iscontinue) {
            //基础界面
            System.out.println("----------------零钱通菜单----------------");
            System.out.println("             1. 零钱通明细");
            System.out.println("             2. 收益入账");
            System.out.println("             3. 消费");
            System.out.println("             4. 退出");
            System.out.print("请选择（1-4）：");
            //获取输入信息
            int choice = sc.nextInt();
            switch (choice) {
                case 1:
                    System.out.println("----------------零钱通明细----------------");
                    rec.getmessage();
                    break;
                case 2:
                    System.out.print("请输入存入的金额：");
                    double in = sc.nextDouble(); //获取输入
                    pocket.inmoney(rec,in);
                    break;
                case 3:
                    System.out.println("消费地点：");
                    String place = sc.next();//获取输入
                    System.out.println("消费金额：");
                    double out = sc.nextDouble();//获取输入
                    pocket.outmoney(rec,place, out);
                    break;
                case 4:
                    iscontinue = false;
                    System.out.println("已退出系统");
                    break;
                default:
                    System.out.println("选择有误，请重新选择");
            }

                }
            }
        }
